<?xml version="1.0" encoding="utf-8"?>
 <grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:if="http://namespaces.xmlschemata.org/xvif/iframe" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
   <define name="born-element">
     <element name="born">
       <if:pipe>
         <if:validate type="http://namespaces.xmlschemata.org/xvif/regexp" apply="m/[0-9]+ .+ [0-9]+/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/^[ \t\n]*([0-9] .*)$/0\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) janvier ([0-9]+)/\2-01-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) fevrier ([0-9]+)/\2-02-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) mars ([0-9]+)/\2-03-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) avril ([0-9]+)/\2-04-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) mai ([0-9]+)/\2-05-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) juin ([0-9]+)/\2-06-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) juillet ([0-9]+)/\2-07-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) aout ([0-9]+)/\2-08-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) septembre ([0-9]+)/\2-09-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) octobre ([0-9]+)/\2-10-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) novembre ([0-9]+)/\2-11-\1/"/>
         <if:transform type="http://namespaces.xmlschemata.org/xvif/regexp" apply="s/([0-9]+) decembre ([0-9]+)/\2-12-\1/"/>
         <if:validate type="http://relaxng.org/ns/structure/1.0">
           <if:apply>
             <data type="date">
               <param name="minInclusive">1900-01-01</param>
               <param name="maxInclusive">2099-12-31</param>
               <param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}</param>
             </data>
           </if:apply>
         </if:validate>
       </if:pipe>
       <text if:ignore="1"/>
     </element>
   </define>
   <start>
     <element name="library" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
       <oneOrMore>
         <element name="book">
           <attribute name="id">
             <data datatypeLibrary="http://relaxng.org/ns/compatibility/datatypes/1.0" type="ID"/>
           </attribute>
           <attribute name="available">
             <data type="boolean"/>
           </attribute>
           <element name="isbn">
             <data type="NMTOKEN">
               <param name="pattern">[0-9]{9}[0-9x]</param>
             </data>
           </element>
           <element name="title">
             <attribute name="xml:lang">
               <data type="language">
                 <param name="length">2</param>
               </data>
             </attribute>
             <data type="token">
               <param name="maxLength">255</param>
             </data>
           </element>
           <zeroOrMore>
             <element name="author">
               <attribute name="id">
                 <data datatypeLibrary="http://relaxng.org/ns/compatibility/datatypes/1.0" type="ID"/>
               </attribute>
               <element name="name">
                 <data type="token">
                   <param name="maxLength">255</param>
                 </data>
               </element>
               <ref name="born-element"/>
               <optional>
                 <element name="dead">
                   <data type="date">
                     <param name="minInclusive">1900-01-01</param>
                     <param name="maxInclusive">2099-12-31</param>
                     <param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}</param>
                   </data>
                 </element>
               </optional>
             </element>
           </zeroOrMore>
           <zeroOrMore>
             <element name="character">
               <attribute name="id">
                 <data datatypeLibrary="http://relaxng.org/ns/compatibility/datatypes/1.0" type="ID"/>
               </attribute>
               <element name="name">
                 <data type="token">
                   <param name="maxLength">255</param>
                 </data>
               </element>
               <ref name="born-element"/>
               <element name="qualification">
                 <data type="token">
                   <param name="maxLength">255</param>
                 </data>
               </element>
             </element>
           </zeroOrMore>
         </element>
       </oneOrMore>
     </element>
   </start>
 </grammar>
